---
category: Object
contributors:
    - tugsanunlu
created: '2020-05-20'
title: Check if multiple objects are equal
updated: '2021-10-13'
---

**JavaScript version**

```js isEqual.js
const isEqual = (...objects) => objects.every((obj) => JSON.stringify(obj) === JSON.stringify(objects[0]));
```

**TypeScript version**

```ts isEqual.ts
const isEqual = (...objects: object[]): boolean =>
    objects.every((obj) => JSON.stringify(obj) === JSON.stringify(objects[0]));
```

**Examples**

```js examples.js
isEqual({ foo: 'bar' }, { foo: 'bar' }); // true
isEqual({ foo: 'bar' }, { bar: 'foo' }); // false
```
